There have been known storage devices that are provided with a data buffer to improve the write performance to a nonvolatile memory such as a solid-state drive (SSD). When completing writing data to the data buffer, such a storage device notifies a host device of the completion of data write operation. Although a volatile memory that stores data when supplied with power from the main power source is used as the data buffer of the storage device, it loses the data if power from the main power source is cut off. Accordingly, the storage device needs a backup power source to supply power to the data buffer when power from the main power source is cut off. The backup power source has a power capacity enough to write back data yet to be written on the data buffer to the nonvolatile memory when power supply to the data buffer is cut off.
While a lithium-ion battery or a large-capacity capacitor is generally used as the backup power source, they both have a characteristic that, as charged/discharged repeatedly, they are deteriorated and the power capacity is reduced. As a result, in conventional storage devices, when the backup power source is deteriorated, all data on the data buffer may not be written back to the nonvolatile memory when power is cut off. Besides, if the storage device is rebooted when all data on the data buffer has not been written back to the nonvolatile memory, old data is read upon reading data that cannot be written back to the nonvolatile memory, resulting in data corruption.
To cope with this, a conventional storage device monitors the capacity of the backup power source at regular intervals, and outputs a warning if the capacity is reduced below a predetermined threshold. Further, the conventional storage device writes a mark (information) indicating that the storage device is turned off properly to the nonvolatile memory after writing back data on the data buffer to the nonvolatile memory. If the mark (information) is not written to the nonvolatile memory when the storage device is turned on, data reading is inhibited by placing the storage device in the state where it requires reformatting or is at fault to avoid data corruption.
The capacity of the backup power source is monitored based generally on the measurement results of the self-discharge time and full-discharge time of the backup power source. Since considerable time is taken to measure the self-discharge time of the backup power source, the monitoring of the capacity requires substantial time in the order of 100 seconds. On the other hand, while the full-discharge time of the backup power source is being measured, the backup power source cannot be used. During the period, the performance of the storage device is significantly degraded. Therefore, the full-discharge time cannot be measured frequently. That is, in the monitoring of the capacity of the backup power source, an interval at which the self-discharge time and full-discharge time can be measured is limited. In addition, power cannot be supplied from the backup power source to the data buffer during the interval.
To avoid data loss due to a sudden drop in power from the backup power source, a mark (information) indicating that the storage device is turned off is written to the nonvolatile memory. If the mark is not written to the nonvolatile memory when the storage device is turned on, even if it is because some kilobytes (KB) data of hundreds of gigabytes (GB) of storage capacity cannot be written back, access to all data in the storage device becomes available. If no data is written back to the storage device, also, access to all data in the storage device becomes available.